package com.wunu.smartlock1.net.api;

import com.wunu.smartlock1.net.param.PA;
import com.wunu.smartlock1.net.param.PB;
import com.wunu.smartlock1.net.param.URegist;
import com.wunu.smartlock1.net.response.ApiNormalResponse;
import com.wunu.smartlock1.net.response.ApiSimpleResponse;
import com.wunu.smartlock1.net.response.LockEvent;
import com.wunu.smartlock1.net.response.ULoginResponse;
import com.wunu.smartlock1.net.response.URegistResponse;
import com.wunu.smartlock1.net.response.USendCaptcha;

import java.util.List;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;

public interface LockEventApi {
    /**
     * 查询开锁历史
     *
     * @param lockId
     * @param group
     * @param pageIndex
     * @param pageSize
     * @return
     */
    @GET("lockEvents")
    Call<ApiNormalResponse<List<LockEvent>>> getLockEvents(@Query("lockId") long lockId, @Query("group") long group, @Query("pageIndex") long pageIndex, @Query("pageSize") long pageSize);

    /**
     * 上传开锁结果，1成功，-1失败，-2（wx-ios）,-3(wx-android)
     *
     * @param lockId
     * @param event
     * @return
     */
    @GET("openLock")
    Call<ApiSimpleResponse> sendOpenLockResult(@Query("lockId") long lockId, @Query("event") int event);

    /**
     * 发送临时锁的开锁结果，1成功，-1失败，-2（wx-ios）,-3(wx-android)
     *
     * @param tempKeyId
     * @param event
     * @return
     */
    @GET("openTempLock")
    Call<ApiSimpleResponse> sendOpenTempLockResult(@Query("tempKeyId") long tempKeyId, @Query("event") int event);


    @POST("regist")
    Call<URegistResponse> regist(@Query("account") String account,@Query("password") String password);
    @POST("regist")
    Call<URegistResponse> registA(@Body PB pb);
    @POST("login")
    Call<ULoginResponse> login(@Query("account") String account, @Query("password") String password);
    @POST("login")
    Call<ULoginResponse> loginA(@Body PB pb);

    @POST("sendCaptcha")
    Call<USendCaptcha> sendCaptcha(@Query("account") String account, @Query("register") boolean register);

    @POST("sendCaptcha")
    Call<Object> sendCaptchaA(@Query("account") String account, @Query("register") boolean register);
    @POST("sendCaptcha")
    Call<USendCaptcha> sendCaptchaA(@Body PA pa);


    @POST("resetPass")
    Call<URegistResponse> resetPass(@Body PB pa);
}